<div class="col-12">
    <div class="card">
        <div class="card-header">
            <h3 class="card-title">{{ .label }}</h3>
            <div class="card-tools">
                <div class="input-group input-group-sm" style="width: 250px;">
                    <a class="btn btn-success btn-sm" data-toggle="modal" data-target="#addModal" title="添加">
                        <i class="fa fa-plus "></i>
                    </a>
                    <input id="search-key" type="text" name="table_search" class="form-control float-right"
                           placeholder="Search" value="{{ .key }}">
                    <div class="input-group-append">
                        <a type="submit" class="btn btn-default" id="search-a">
                            <i class="fa fa-search" style="color: grey"></i>
                        </a>
                    </div>
                </div>
            </div>
        </div>
        <!-- /.card-header -->
        <div class="card-body table-responsive p-0">
            <table class="table table-hover">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>脚本</th>
                    <th>参数</th>
                    <th>作者</th>
                    <th>备注</th>
                    <th>创建时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                {{ range  .data_list }}
                    <tr name="tbody">
                        <td>{{ .ID }}</td>
                        <td>{{ .ScriptName }}</td>
                        <td>{{ .ScriptArg }}</td>
                        <td>{{ .AddUser}}</td>
                        <td>{{ .ScriptMsg }}</td>
                        <td>{{ date .CreatedAt "Y-m-d H:i:s" }}</td>
                        <td>
                            <a class="btn btn-xs btn-info" href="javascript:;" name="edit" edit_id="{{ .ID }}"
                               style="text-decoration:none;" title="修改"><span class="fa fa-pencil"></span></a>
                            <a class="btn btn-xs btn-success" href="javascript:;" name="exec" exec_id="{{ .ID }}"
                               style="text-decoration:none;" title="执行"><span class="fa fa-mouse-pointer"></span> </a>
                            <a class="btn btn-xs btn-danger" href="javascript:;" name="del" del_id="{{ .ID }}"
                               style="text-decoration:none;" title="删除"><span class="fa fa-trash"></span></a>
                        </td>
                    </tr>
                {{ end }}
                </tbody>
            </table>

        </div>
        <!-- /.card-body -->
        <div class="card-footer clearfix">
            <ul class="pagination pull-right" style="margin-right: 50px">
                {{if eq $.page.CurPage 1 }}
                    <li class="page-item disabled"><a class="page-link" href="/ops/script/1/">首页</a></li>
                    <li class="page-item disabled"><a class="page-link disabled"
                                                      href="/ops/script/{{ Sub $.page.CurPage 1 }}/">上一页</a></li>
                {{ else }}
                    <li class="page-item"><a class="page-link" href="/ops/script/1/">首页</a></li>
                    <li class="page-item"><a class="page-link" href="/ops/script/{{ Sub $.page.CurPage 1 }}/">上一页</a>
                    </li>
                {{ end }}
                </li>

                {{range $k,$v:=.page.Nums}}
                    <li class="page-item"><a class="page-link {{if eq $v $.page.CurPage}}active{{end}}"
                                             href="/ops/script/{{$v}}/">{{ $v }}</a></li>
                    </li>
                {{end}}

                {{if eq $.page.CurPage .page.PageCount }}
                    <li class="page-item disabled"><a class="page-link"
                                                      href="/ops/script/{{ Add $.page.CurPage 1 }}/">下一页</a></li>
                    <li class="page-item disabled"><a class="page-link" href="/ops/script/{{.page.PageCount }}/">尾页</a>
                    </li>
                {{ else }}
                    <li class="page-item"><a class="page-link" href="/ops/script/{{ Add $.page.CurPage 1 }}/">下一页</a>
                    </li>
                    <li class="page-item"><a class="page-link" href="/ops/script/{{.page.PageCount }}/">尾页</a></li>
                {{ end }}
            </ul>
        </div>
    </div>
    <!-- /.card -->
</div>

<div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="addModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title" id="addModalLabel">添加</h4>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">&times;</span></button>

            </div>
            <div class="modal-body">
                <div class="form-group">
                    <label>名称</label>
                    <input class="form-control" placeholder="test.sh" id="script-name">
                </div>
                <div class="form-group">
                    <label>参数</label>
                    <input class="form-control" placeholder="arg1,arg2,arg3,..." id="script-arg">
                </div>

                <div class="form-group">
                    <label>备注</label>
                    <input class="form-control" placeholder="脚本描述" id="script-msg">
                </div>

                <div class="form-group">
                    <lable><span style="color: red"> * </span> 脚本</lable>
                    <!--代码输入框（注意请务必设置高度，否则无法显示）-->
                    <pre id="code" class="ace_editor" style="min-height:250px"><textarea class="ace_text-input"
                                                                                         id="script-txt"></textarea></pre>
                </div>

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" id="add-sub">提交</button>
            </div>
        </div>
    </div>
</div>


<div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="editModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title" id="editModalLabel">修改</h4>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">&times;</span></button>

            </div>
            <div class="modal-body">
                <div class="form-group">
                    <label>名称</label>
                    <input class="form-control" placeholder="test.sh" id="edit-script-name">
                </div>
                <div class="form-group">
                    <label>参数</label>
                    <input class="form-control" placeholder="arg1,arg2,arg3,..." id="edit-script-arg">
                </div>

                <div class="form-group">
                    <label>备注</label>
                    <input class="form-control" placeholder="脚本描述" id="edit-script-msg">
                </div>

                <div class="form-group">
                    <lable><span style="color: red"> * </span> 脚本</lable>
                    <!--代码输入框（注意请务必设置高度，否则无法显示）-->
                    <pre id="edit-code" class="ace_editor" style="min-height:250px"><textarea class="ace_text-input"
                                                                                              id="edit-script-txt"></textarea></pre>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" id="edit-sub">提交</button>
            </div>
        </div>
    </div>
</div>


<div class="modal fade" id="execModal" tabindex="-1" role="dialog" aria-labelledby="execModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title" id="execModalLabel">选择服务器</h4>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">&times;</span></button>

            </div>
            <div class="modal-body">
                <ul id="treeDemo" class="ztree"></ul>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" id="exec-sub">提交</button>
            </div>
        </div>
    </div>
</div>